package cn.wolfcode.luowowo.controller;

import cn.wolfcode.luowowo.domain.Spot;
import cn.wolfcode.luowowo.query.SpotQuery;
import cn.wolfcode.luowowo.service.ISpotService;
import cn.wolfcode.luowowo.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

// 景点
@RestController
@RequestMapping("spots")
public class SpotController {

    @Autowired
    private ISpotService spotService;


    // 旅游景点下的查询景点
    @GetMapping("/detail")
    public Object detail(String id){
        return JsonResult.success(spotService.get(id));
    }

    // 旅游景点按钮之分页
    @GetMapping("/query")
    public Object query(SpotQuery qo){
        return JsonResult.success(spotService.query(qo));
    }


    @GetMapping("/list")
    public Object list(){
        List<Spot> list = spotService.listAll();
        return JsonResult.success(list);
    }

}
